package com.sulent.frame.web.template;

import org.apache.commons.net.ftp.FTPFile;
import org.apache.tomcat.util.http.fileupload.FileUpload;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.ftp.gateway.FtpOutboundGateway;
import org.springframework.integration.ftp.session.FtpRemoteFileTemplate;
import org.springframework.integration.message.AdviceMessage;
import org.springframework.stereotype.Component;

import java.io.File;

//@Component
public class FtpService {


    @Autowired
    FtpRemoteFileTemplate ftpRemoteFileTemplate;


    public String fileList(String path){
        FTPFile[] tests = ftpRemoteFileTemplate.list(path);
        for (FTPFile test : tests) {
            String name = test.getName();
            System.out.println(name);
        }
        return "success!";
    }


    public void remove(){

        boolean remove = ftpRemoteFileTemplate.remove("request.json");


    }







}